package com.buer.storage.service.impl;

import com.buer.storage.dao.StockdetailsDao;
import com.buer.storage.entity.Stockdetails;
import com.buer.storage.service.StockdetailsService;
import com.buer.storage.vo.StockDetailVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class StockdetailsServiceImpl implements StockdetailsService {
    @Resource
    private StockdetailsDao stockdetailsDao;

    @Override
    public PageInfo<Stockdetails> selectStockdetailsAll(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<Stockdetails> list = stockdetailsDao.selectStockdetailsAll(map); // 获取数据
        PageInfo<Stockdetails> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public PageInfo<Stockdetails> getStock(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<Stockdetails> list = stockdetailsDao.getStock(map); // 获取数据
        PageInfo<Stockdetails> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public PageInfo<Stockdetails> searchStock(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<Stockdetails> list = stockdetailsDao.searchStock(map); // 获取数据
        PageInfo<Stockdetails> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public List<StockDetailVo> getAllStockDetails() {
        return stockdetailsDao.getAllStockDetails();
    }

    @Override
    public List<Stockdetails> getStockdetailsList(Map<String, Object> map) {
        return stockdetailsDao.getStockdetailsList(map);
    }

    @Override
    public int updateDetailStatusById(int stockdetailsId) {
        return stockdetailsDao.updateDetailStatusById(stockdetailsId);
    }

    @Override
    public StockDetailVo getStockdetailsById(Integer id) {
        return stockdetailsDao.getStockdetailsById(id);
    }


}
